<?php
/** 初始化项目 */
require '../../app/app.php';
/** 初始化数据库 */
use app\util\Mysql;
$database = Mysql::init();

$out= array('code' =>'0' ,"msg"=>"","count"=>"","data"=>"" );//定义返回数组
// $limit = isset($_POST['limit']) ? intval($_POST['limit']) : 5;
// $page = isset($_POST['page']) ? intval($_POST['page']) : 1;
// $offset = $limit * ($page - 1);
$page = ($_POST["page"]-1)* $_POST["limit"];//数组以0起始
$limit = $_POST["limit"];
//$name = $_POST["name"];
//$list = $database->select("user_text",["id","username","phone","email","imgurl","static"],["username" => "%$name%" ,"LIMIT"=>[$page,$limit]]);//请求数据库数据
$list = $database->select("user_text",["id","username","phone","email","imgurl","static"],["LIMIT"=>[$page,$limit]]);//请求数据库数据
$out["count"]=$database->count("user_text");
$out["data"] = $list;
echo json_encode($out);
?>